package com.miaomiao.domain.system;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class RoleMenuIds {

    /**
     * 角色ID
     */
    private Long roleId;

    /**
     * 角色名称
     */
    private String roleName;

    /**
     * 权限字符
     */
    private String roleKey;

    /**
     * 排序
     */
    private Integer roleSort;

    /**
     * 角色状态（0正常 1停用）
     */
    private Boolean status;

    /**
     * 备注
     */
    private String remark;

    private List<Long> menuIds;

    public Role getRole(){
        return new Role(roleId,roleName,roleKey,roleSort,status,remark);
    }

    public List<RoleMenu> getRoleMenus(){
        List<RoleMenu> roleMenus = new ArrayList<>();
        for (Long menuId : menuIds) {
            RoleMenu roleMenu = new RoleMenu(roleId,menuId);
            roleMenus.add(roleMenu);
        }
        return roleMenus;
    }

}
